<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    function varTest(){
        if (true){
            var temp = "aaa";
        }

        alert(temp)
    }

    // varTest();

    function letTest(){
        if (true){
            let temp = "aaa";
        }

        alert(temp)
    }
    letTest();
</script>
</html>